"""
我的帖子页面测试
"""
import time

from selenium.webdriver.common.by import By

from Utils.Utils import ForumDriver


class myPost:
    url = ""
    driver = ""

    def __init__(self):
        self.url = "http://127.0.0.1:58080/index.html"
        self.driver = ForumDriver.driver
        self.driver.get(self.url)

    def FindElement(self):
        # 点击主页图标
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        # 点击我的帖子按钮
        self.driver.find_element(By.CSS_SELECTOR, "#index_user_profile").click()
        # time.sleep(2)
        # 查找日期元素
        self.driver.find_element(By.CSS_SELECTOR, "#profile_createTime")
        # 查找发帖数元素
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(1)")
        # 查找注册日期图标元素
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(3) > svg")
        # 查找邮箱图标元素
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(2) > svg")
        ForumDriver.GetScreenShot()
        # time.sleep(2)
        self.driver.quit()

## 如果能找到上述元素，说明就能正常的访问我的帖子页面
